﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace Location.API.Model
{
    public class Locations
    {
        [BsonId]
        [BsonRepresentation(BsonType.ObjectId)]
        public string Id { get; set; }

        [BsonRepresentation(BsonType.ObjectId)]
        public string ParentId { get; set; }
        /// <summary>
        /// 省
        /// </summary>
        public string Province { get; set; }
        /// <summary>
        /// 市
        /// </summary>
        public string City { get; set; }
        /// <summary>
        /// 区
        /// </summary>
        public string District { get; set; }
        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; }
        /// <summary>
        /// 详细地址
        /// </summary>
        public string DetailedAddress { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        public string Description { get; set; }
        /// <summary>
        /// 经度
        /// </summary>
        [Column(TypeName = "decimal(18,8)")]
        public decimal? Latitude { get; set; }
        /// <summary>
        /// 纬度
        /// </summary>
        [Column(TypeName = "decimal(18,8)")]
        public decimal? Longitude { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsRemove { get; set; }
        protected Locations() { }
        public Locations(string province,string city,string district,string detailedAddress,string phone, string description,decimal? longitude = null, decimal? latitude = null,string remark = "")
        {
            this.Province = province;
            this.City = city;
            this.District = district;
            this.DetailedAddress = detailedAddress;
            this.Phone = phone;
            this.Description = description;
            this.Longitude = longitude;
            this.Latitude = latitude;
            this.Remark = remark;
            this.CreateTime = DateTime.Now;
            this.IsRemove = false;
        }
    }
}
